<?php
/**
 * Created by PhpStorm.
 * User: cen
 * Date: 2020/6/26
 * Time: 17:47
 */

namespace app\admin\controller;

use think\Controller;
use app\admin\model\MessageModel;

class Message extends Controller
{
    public function index(){
        return $this->fetch();
    }

    public function tableData(){

        $list = MessageModel::with('user')->order('create_time desc')->paginate(10)->toArray();

        return json([
            'code' => 0,
            'msg' => '',
            'count' => $list['total'],
            'data' => $list['data'],
        ]);
    }

    public function del(){
        $id = $this->request->param('id');
        $res = MessageModel::find($id);

        $res->status = 1;
        $res->save();

        return json('ok');
    }


}